/**
 *  学习目标：
 */
import React from 'react'

export default class App extends React.Component {
  state = {
    count: 1,
  }

  handleClick = () => {
    // this.setState({ count: this.state.count + 1 })
    this.setState({ count: this.state.count + 1 }, () => {
      // 🔔 第二个参数：DOM 更新后才触发的回调函数，相当于 Vue 的 this.$nextTick(()=>{ })
      console.log(this.state.count)
    })
    // this.$nextTick(()=>{ })
  }

  render() {
    return (
      <>
        <h1>知识点标题</h1>
        <h2>count:{this.state.count}</h2>
        <button onClick={this.handleClick}>点击修改state</button>
      </>
    )
  }
}
